<?php
require_once '../DTO/Vung.php';
require_once 'DBConnection.php';

class VungDAO extends DBConnection{
	public function __construct(){
		parent::__construct();
	}
	
	//Lấy danh sách tất cả các vùng
	public function getVung(){
		$sql = "select * from vung";
		
		$res = mysql_query($sql, $this->hDB);
		
		if(!($res && mysql_num_rows($res))){
			return NULL;
		}
		
		if(mysql_num_rows($res)){
			$objs = array();
			$temp = mysql_fetch_assoc($res);
			while ($temp){
				$objs[] = new Vung($temp['MaVung'], $temp['TenVung']);
				$temp = mysql_fetch_assoc($res);
			}
			return $objs;
		}else{
			return array();
		}
	}
}